


"""
    every的留言信息typeId = 65
"""
from Common import sql_content


class _everyDay(object):
    def __init__(self):
        #self.mix =
        self.sql_content = sql_content.sql_content()

        self.list_row = []
        self.all_mag = []
        self.all={}

    def get_all_mag(self,everyDay):
        self.sql_everyDay(everyDay)
        self.sql_mag()
        self.all['everyDay'] = self.list_row
        self.all['all_mag'] = self.all_mag

        if self.all is not None:
            print(self.all)
            return self.all
        else:
            return -1


    def sql_mag(self):
        #print(self.min, self.max)
        con = self.sql_content.conten()
        sql_mag = "select * from message WHERE typeId = 65"
        cursor = con.cursor()
        try:
            cursor.execute(sql_mag)
            rs = cursor.fetchall()
            for row in rs:
                list_row = list(row)
                # print(list_row[3])
                self.all_mag.append(list_row)
            # for i in range(len(self.all_mage)):
            #     for j in range(len(i+1)):
            #         if self.all_mag[i][6] == self.all_mag[j][7]:


            print(self.all_mag)
        except Exception as e:
            print(e)
            con.rollback()
        cursor.close()
        con.close()


    def sql_everyDay(self, everyDayId):
        #print(self.min, self.max)
        con = self.sql_content.conten()
        sql_everyDay = "select * from everyDay WHERE everyDayId = %d" % (everyDayId,)
        cursor = con.cursor()
        try:
            cursor.execute(sql_everyDay)
            rs = cursor.fetchall()
            self.list_row = list(rs)
        except Exception as e:
            print(e)
            con.rollback()
        cursor.close()
        con.close()

if __name__ == "__main__":
    _everyDay().get_all_mag(2)